ostree.git
10 years agostatic-delta: Handle LZMA_BUF_ERROR returned by zlib
John Hiesey [Wed, 7 Oct 2015 20:30:33 +0000 (13:30 -0700)]
static-delta: Handle LZMA_BUF_ERROR returned by zlib

zlib can return LZMA_BUF_ERROR, which indicates that either
the input or output buffer has size zero. This case should cause
the correct error to be passed back from g_converter_convert
to expand the relevant buffer. Since this error is ambiguous
as to which buffer is too small, an explicit check on the
output buffer size is added as well.

https://bugzilla.gnome.org/show_bug.cgi?id=756260

10 years agotests: Add a test for pull+deploy of specific "bare" commit
Colin Walters [Wed, 23 Sep 2015 19:03:48 +0000 (15:03 -0400)]
tests: Add a test for pull+deploy of specific "bare" commit

This is the "pull an older version" that's now supported since
36d65b3cfcc9557552314d112493516437d6fcd4

https://github.com/GNOME/ostree/pull/145

10 years agodoc: Note that refs --delete does not prune
Colin Walters [Mon, 28 Sep 2015 19:49:12 +0000 (15:49 -0400)]
doc: Note that refs --delete does not prune

10 years agopull: Recover from missing commits in recursive pulls
Matthew Barnes [Thu, 24 Sep 2015 14:43:56 +0000 (10:43 -0400)]
pull: Recover from missing commits in recursive pulls

When traversing parents, do not fail on a missing commit.  We may
be pulling from a partial repository that ends in a dangling parent
reference.

10 years agosysroot: Cleanup refs and prune even on last undeployment
Colin Walters [Thu, 24 Sep 2015 15:00:54 +0000 (11:00 -0400)]
sysroot: Cleanup refs and prune even on last undeployment

I was working on a different test, and ended up being very confused at
the behavior where removing the last deployment didn't remove the last
`ostree/X/X/X` ref pointing to its commit.

There's no reason to special case the last undeployment AFAIK, and the
existing code handles this.

10 years agofetcher: Track outstanding requests with a table
Matthew Barnes [Wed, 23 Sep 2015 23:28:47 +0000 (19:28 -0400)]
fetcher: Track outstanding requests with a table

Track outstanding HTTP requests in a table for easier debugging.

Also fixes a bug discussed in https://bugzilla.gnome.org/755224
where the outstanding request counter was not decremented in the
event of an error, which could result in the fetcher hitting its
max request limit and locking up.

The bug is fixed by removing the request struct from the table in
pending_uri_free(), which is always called regardless of error,
so the outstanding request count is always accurate.

10 years agofetcher: Rework reference counting
Matthew Barnes [Wed, 23 Sep 2015 21:11:51 +0000 (17:11 -0400)]
fetcher: Rework reference counting

Have OstreeFetcherPendingURI be the GTask's task_data and pass the GTask
around in queues and callback closures.  The reference counting before
was a little confusing and this helps clarify it, at least to me.

OstreeFetcherPendingURI no longer needs its own reference count.

10 years agofetcher: Convert from GSimpleAsyncResult to GTask
Matthew Barnes [Wed, 23 Sep 2015 19:41:24 +0000 (15:41 -0400)]
fetcher: Convert from GSimpleAsyncResult to GTask

Obsessive compulsive cleanup.

10 years agofetcher: Remove message_to_request table
Matthew Barnes [Wed, 23 Sep 2015 17:24:41 +0000 (13:24 -0400)]
fetcher: Remove message_to_request table

Does not appear to be needed, no lookups on the table.

10 years agoRelease 2015.9
Colin Walters [Wed, 23 Sep 2015 16:10:22 +0000 (12:10 -0400)]
Release 2015.9

10 years agoRemove unused variables
Gatis Paeglis [Wed, 23 Sep 2015 10:46:06 +0000 (12:46 +0200)]
Remove unused variables

10 years agoMutable is a keyword in C++11
Leandro Santiago [Tue, 22 Sep 2015 11:52:29 +0000 (13:52 +0200)]
Mutable is a keyword in C++11

This fix allows including OSTree on C++ projects.

10 years agopull: Honor depth with OSTREE_REPO_PULL_FLAGS_COMMIT_ONLY
Matthew Barnes [Mon, 21 Sep 2015 13:36:00 +0000 (09:36 -0400)]
pull: Honor depth with OSTREE_REPO_PULL_FLAGS_COMMIT_ONLY

https://bugzilla.gnome.org/755224

10 years agorepo: Fix build without libsoup
Matthew Barnes [Mon, 21 Sep 2015 20:11:40 +0000 (16:11 -0400)]
repo: Fix build without libsoup

Had a rare situation where I had no libsoup development files, so I
took the opportunity to fix the build errors.  Ugly, but works now.

Would be nice if libsoup could be a hard dependency since we rarely
ever test a configuration without it.

10 years agoreset: Simplify argument checking logic
Matthew Barnes [Thu, 17 Sep 2015 16:25:37 +0000 (12:25 -0400)]
reset: Simplify argument checking logic

10 years agolibglnx: Update from master
Matthew Barnes [Wed, 16 Sep 2015 18:19:05 +0000 (14:19 -0400)]
libglnx: Update from master

Pick up PATH change for glnx_libcontainer_run_chroot_private().

10 years agodeploy: Do not prune repository
Matthew Barnes [Tue, 15 Sep 2015 18:40:18 +0000 (14:40 -0400)]
deploy: Do not prune repository

To support deploying older commits:

  ostree pull <remote> <checksum>
  ostree admin deploy <checksum>

Prior to this, the deploy command garbage collected <checksum> since
there's no ref pointing to it, and then ostree_sysroot_deploy_tree()
fails because it can't find the <checksum> commit.

https://bugzilla.gnome.org/732526

10 years agosysroot: Add ostree_sysroot_prepare_cleanup()
Matthew Barnes [Wed, 9 Sep 2015 18:50:14 +0000 (14:50 -0400)]
sysroot: Add ostree_sysroot_prepare_cleanup()

New public function works like ostree_sysroot_cleanup() EXCEPT FOR
pruning the repository.

Under the hood, add _ostree_sysroot_piecemeal_cleanup() which takes
flags to better control what files are cleaned up.  Both public cleanup
functions are now wrappers for _ostree_sysroot_piecemeal_cleanup() with
different flags.

10 years ago_ostree_static_delta_part_validate: Take a stream instead of a file as arg
Alexander Larsson [Thu, 10 Sep 2015 18:16:52 +0000 (20:16 +0200)]
_ostree_static_delta_part_validate: Take a stream instead of a file as arg

This is only called in one place, and we have already opened the file there,
no need to open it twice.

10 years agotests: Add a test for static-delta apply-offline
Colin Walters [Mon, 14 Sep 2015 01:35:10 +0000 (21:35 -0400)]
tests: Add a test for static-delta apply-offline

Obviously it was broken...

10 years agooffline delta apply: Handle the version field
Alexander Larsson [Thu, 10 Sep 2015 17:42:28 +0000 (19:42 +0200)]
offline delta apply: Handle the version field

It seems the format changed and this code was not updated.

10 years agocommit: Clarify reasoning for "commit-update-summary" default
Matthew Barnes [Fri, 11 Sep 2015 17:15:58 +0000 (13:15 -0400)]
commit: Clarify reasoning for "commit-update-summary" default

In case anyone else gets the idea of changing the default for archive-z2
repos.  Should have the rationale captured in the source code somewhere.

10 years agopull: honor gpg-verify-summary=false when a summary signature is present
Giuseppe Scrivano [Thu, 10 Sep 2015 08:16:47 +0000 (10:16 +0200)]
pull: honor gpg-verify-summary=false when a summary signature is present

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agopull: Go back to using one main context
Colin Walters [Tue, 1 Sep 2015 02:37:37 +0000 (22:37 -0400)]
pull: Go back to using one main context

xdg-app was hanging for me with v2015.8, but worked with v2015.7.
I narrowed things down to the GMainLoop/context commit, in which
we started pushing a temporary main context for synchronous
requests internally.

That's never really going to work with libsoup - there needs
to be a single main context which works on the socket.  Furthermore,
clients couldn't get progress messages that way.

For *other* internal uses where we added APIs that talk to the remote
repo, we cleanly push a temporary main context.

(Note that I kind of snuck in a change here around the GError handling
 in pulls that isn't strictly related but came up in testing)

10 years agopull: Only fetch all refs if we're mirroring
Colin Walters [Tue, 1 Sep 2015 02:54:04 +0000 (22:54 -0400)]
pull: Only fetch all refs if we're mirroring

I noticed xdg-app was looping trying to fetch 1427 refs.  We
don't want to do that unless asked to.

(And also, we need to make static delta requests async)

10 years agofetcher: Use 0666 (-umask) for temporary files
Colin Walters [Wed, 26 Aug 2015 19:41:39 +0000 (15:41 -0400)]
fetcher: Use 0666 (-umask) for temporary files

There's no reason to keep them hidden.  I have a hard policy that
OSTree should *not* be used to carry secrets.  Things like host ssh
private keys should be set up out of band by an OS-external
configuration mechanism such as kickstart, cloud-init, etc.

We also assume that hiding binaries is not very useful as most
attackers would be able to find them on the Internet or (for
subscribed content) acting as a customer.

This fixes a bug with mirroring because we changed to take the
unmodified upstream objects rather than uncompress <-> recompress.

https://bugzilla.gnome.org/show_bug.cgi?id=748959

10 years agoRelease 2015.8
Colin Walters [Wed, 26 Aug 2015 20:54:20 +0000 (16:54 -0400)]
Release 2015.8

10 years agostatic-delta: assert on non-regular files
John Hiesey [Wed, 26 Aug 2015 19:11:38 +0000 (12:11 -0700)]
static-delta: assert on non-regular files

Now that the computed similar objects are all regular files,
get_unpacked_unlinked_content should never be called on any other
object type. Assert that this is true instead of silently succeeding.

10 years agostatic-delta: Ignore symlinks when computing similar objects
John Hiesey [Wed, 26 Aug 2015 01:15:53 +0000 (18:15 -0700)]
static-delta: Ignore symlinks when computing similar objects

_ostree_delta_compute_similar_objects should not output symlinks.
Previously, a symlink in the "from" commit could be matched to a
real file in the "to" commit, since nothing was filtering symlinks
on the "from" side. This led to failures running the bzdiff
algorithm.

10 years agotests: Build test-lzma with LZMA flags
Dan Nicholson [Wed, 26 Aug 2015 16:54:31 +0000 (09:54 -0700)]
tests: Build test-lzma with LZMA flags

test-lzma builds a copy of the compressor and decompressor directly, so
the compiler needs access to the LZMA headers and the linker needs to
link the program with liblzma.

10 years agoUpdate .gitignore
Jasper St. Pierre [Wed, 26 Aug 2015 19:16:29 +0000 (12:16 -0700)]
Update .gitignore

10 years agorepo-pull: Add a queue for scanning
Jasper St. Pierre [Thu, 6 Aug 2015 22:45:21 +0000 (15:45 -0700)]
repo-pull: Add a queue for scanning

On systems with slow disks, the recursive scanning of directories can
be expensive -- it takes upwards of 2 minutes on our systems. This can
block the main loop for such a long time that it allows the download to
time out...

As such, move all the scanning of objects to a queue, processed from
an idle, to make sure that we don't block the main loop when scanning.

https://bugzilla.gnome.org/show_bug.cgi?id=753336

10 years agotests: Add tests for rollsum
Giuseppe Scrivano [Tue, 25 Aug 2015 13:27:56 +0000 (09:27 -0400)]
tests: Add tests for rollsum

10 years agorollsum: Fix assertion for CRC matches
Colin Walters [Tue, 25 Aug 2015 13:26:22 +0000 (09:26 -0400)]
rollsum: Fix assertion for CRC matches

It's possible for two blocks to have the same CRC but different
length.  Rather than asserting, treat them as not matching.

10 years agotests: rename test-rollsum to test-rollsum-cli
Giuseppe Scrivano [Fri, 14 Aug 2015 06:43:44 +0000 (08:43 +0200)]
tests: rename test-rollsum to test-rollsum-cli

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agopull: Stop using GMainLoop
Colin Walters [Wed, 12 Aug 2015 21:03:52 +0000 (17:03 -0400)]
pull: Stop using GMainLoop

First of all, what we were doing with having GMainLoop in the internal
APIs is wrong.  Synchronous APIs should always create their own main
context and not iterate the caller's.  Doing the latter creates
potential for evil reentrancy issues.  Sync API should block, async
API is for not blocking.

Now that's out of the way, fix the pull code to do the clean

```
while (termination_condition (state))
  g_main_context_iteration (mainctx, TRUE);
```

model for looping.  This is a lot easier to understand and ultimately
more reliable than having other code call `g_main_loop_quit()`, as the
loop condition is in exactly one place.

We can also remove the idle source which only fired once.

Note we have to add a hack here to discard the synchronous session and
create a new one which we only use async.

https://bugzilla.gnome.org/show_bug.cgi?id=753336

10 years agosysroot: Add an unload() API
Colin Walters [Thu, 13 Aug 2015 16:43:14 +0000 (12:43 -0400)]
sysroot: Add an unload() API

This will be used by gnome-continuous at least to drop the reference
to the fd so that unmounting can proceed.  See
https://git.gnome.org/browse/gnome-continuous/commit/?id=95e9910ea288d302509ca667e0d190dd89377dd5

10 years agotests: add tests for LZMA compressor and decompressor
Giuseppe Scrivano [Tue, 11 Aug 2015 09:26:14 +0000 (11:26 +0200)]
tests: add tests for LZMA compressor and decompressor

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agoUpdate .gitignore
Jasper St. Pierre [Thu, 6 Aug 2015 23:18:06 +0000 (16:18 -0700)]
Update .gitignore

https://bugzilla.gnome.org/show_bug.cgi?id=753336

10 years agotests: skip tests using gjs/parallel if they are not installed
Giuseppe Scrivano [Wed, 5 Aug 2015 14:51:30 +0000 (16:51 +0200)]
tests: skip tests using gjs/parallel if they are not installed

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Closes #131

10 years agotests: add tests for --disable-bsdiff and --max-bsdiff-size
Giuseppe Scrivano [Wed, 29 Jul 2015 08:26:27 +0000 (10:26 +0200)]
tests: add tests for --disable-bsdiff and --max-bsdiff-size

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agoREADME: Attempt to flesh out more, start moving docs from wiki
Colin Walters [Tue, 28 Jul 2015 22:38:47 +0000 (18:38 -0400)]
README: Attempt to flesh out more, start moving docs from wiki

I'd like to migrate content from the GNOME wiki, as frankly the wiki
is crap.  Markdown in git is better in every way.

Start by fleshing out the README.md to be more useful.

10 years agoUpdate .gitignore
Jasper St. Pierre [Fri, 1 May 2015 21:53:42 +0000 (14:53 -0700)]
Update .gitignore

https://bugzilla.gnome.org/show_bug.cgi?id=752950

10 years agorepo: don't forget to abort the transaction when failed
Cosimo Cecchi [Tue, 28 Jul 2015 00:17:26 +0000 (17:17 -0700)]
repo: don't forget to abort the transaction when failed

ostree_repo_prepare_transaction() should always be matched with a call
to either ostree_repo_commit_transaction() or
ostree_repo_abort_transaction().

Since ostree_repo_pull_with_options() does not call
ostree_repo_abort_transaction() on errors, the OstreeRepo instance will
hit an assertion when it's re-used later for another attempt, such as
when the update is driven by an external component through libostree and
network temporarily goes down.

This commit simply always calls ostree_repo_abort_transaction() in the
exit path of ostree_repo_pull_with_options(), since the function is safe
to call even when we're not in a transaction, and that matches e.g. what
ostree-sysroot-cleanup.c does.

10 years agorepo: fix an incorrect comment
Cosimo Cecchi [Tue, 28 Jul 2015 00:15:21 +0000 (17:15 -0700)]
repo: fix an incorrect comment

10 years agostatic-delta: add max-bsdiff-size option
Giuseppe Scrivano [Tue, 28 Jul 2015 10:39:36 +0000 (12:39 +0200)]
static-delta: add max-bsdiff-size option

It allows to specify the maximum size for input files to attempt
bsdiff compression for.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agostatic-delta: do not fail compilation with big files
Giuseppe Scrivano [Tue, 28 Jul 2015 10:28:25 +0000 (12:28 +0200)]
static-delta: do not fail compilation with big files

Just skip the bsdiff compression instead of failing the operation.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agopull: new option --commit-metadata-only
Giuseppe Scrivano [Fri, 24 Jul 2015 09:26:57 +0000 (11:26 +0200)]
pull: new option --commit-metadata-only

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agorepo: new function _ostree_preload_metadata_file
Giuseppe Scrivano [Thu, 23 Jul 2015 11:34:58 +0000 (13:34 +0200)]
repo: new function _ostree_preload_metadata_file

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agorepo: merge repo_remote_fetch_summary_{metalink,url}
Giuseppe Scrivano [Thu, 23 Jul 2015 10:56:30 +0000 (12:56 +0200)]
repo: merge repo_remote_fetch_summary_{metalink,url}

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agolibostree: new API ostree_repo_remote_list_refs
Giuseppe Scrivano [Wed, 22 Jul 2015 10:16:51 +0000 (12:16 +0200)]
libostree: new API ostree_repo_remote_list_refs

The new API permits to query a remote repository summary file and
retrieve the list of available refs.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agotests: do not commit from the working directory
Giuseppe Scrivano [Tue, 21 Jul 2015 13:41:39 +0000 (15:41 +0200)]
tests: do not commit from the working directory

It fixes this problem:

```
error: Not a regular file or symlink: S.gpg-agent
```

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agotests: Export OSTREE_SYSROOT in setup_os_repository
Matthew Barnes [Tue, 14 Jul 2015 17:30:05 +0000 (13:30 -0400)]
tests: Export OSTREE_SYSROOT in setup_os_repository

Eliminates the need for constantly passing --sysroot=sysroot, but
also makes ostree place remote configs for sysroot/ostree/repo in
sysroot/etc/ostree/remotes.d where they should have been all along.

10 years agomain: Fix UID check based on sysroot path
Matthew Barnes [Tue, 14 Jul 2015 17:14:02 +0000 (13:14 -0400)]
main: Fix UID check based on sysroot path

This is another place where we were hard-coding a default.  Create the
OstreeSysroot first and THEN check if its path is the root directory.

10 years agorepo: Fix location of remote configs for system repos
Matthew Barnes [Mon, 13 Jul 2015 22:02:07 +0000 (18:02 -0400)]
repo: Fix location of remote configs for system repos

Need to respect the repo's system root directory instead of assuming the
compile-time $(sysconfdir).

10 years agosysroot: Pass the internal repo a system root path
Matthew Barnes [Mon, 13 Jul 2015 21:15:03 +0000 (17:15 -0400)]
sysroot: Pass the internal repo a system root path

10 years agorepo: Add a "sysroot-path" property
Matthew Barnes [Mon, 13 Jul 2015 21:12:18 +0000 (17:12 -0400)]
repo: Add a "sysroot-path" property

Adds ostree_repo_new_for_sysroot_path() to specify a system root path.
OstreeRepo otherwise uses _ostree_get_default_sysroot_path().

10 years agosysroot: Use _ostree_get_default_sysroot_path()
Matthew Barnes [Tue, 14 Jul 2015 16:02:46 +0000 (12:02 -0400)]
sysroot: Use _ostree_get_default_sysroot_path()

Instead of hard-coding the root directory as default.

10 years agocore: Add _ostree_get_default_sysroot_path()
Matthew Barnes [Tue, 14 Jul 2015 15:58:00 +0000 (11:58 -0400)]
core: Add _ostree_get_default_sysroot_path()

Returns a GFile for the default system root, which is usually the root
directory unless overridden by the OSTREE_SYSROOT environment variable
(which is mainly intended for testing).

10 years agopull: Plug a memory leak
Colin Walters [Tue, 30 Jun 2015 01:57:29 +0000 (21:57 -0400)]
pull: Plug a memory leak

10 years agopull: Avoid leaking signal handlers across fetch requests
Colin Walters [Tue, 30 Jun 2015 01:56:03 +0000 (21:56 -0400)]
pull: Avoid leaking signal handlers across fetch requests

libsoup will cache sessions, so it might be the case that we get a
reused session when pulling from the same repo multiple times in one
process.

In this case we were leaking signal connections, which caused
callbacks into freed memory with bad consequences.

Fix it by tying the signal connection to the object lifetime.

10 years agobuild: Make gtk-doc optional
Jeremy Cline [Mon, 29 Jun 2015 17:20:57 +0000 (13:20 -0400)]
build: Make gtk-doc optional

This is similar to what's done in glib.

10 years agotests: Check error messages instead of "expected-fail", handle old parallel
Colin Walters [Mon, 29 Jun 2015 17:35:07 +0000 (13:35 -0400)]
tests: Check error messages instead of "expected-fail", handle old parallel

10 years agopull: Also fix misplaced remote name handling
Colin Walters [Mon, 29 Jun 2015 15:20:41 +0000 (11:20 -0400)]
pull: Also fix misplaced remote name handling

We want to set the remote name only if we're operating on a remote
URL.

10 years agocore: Fix inverted conditional in GPG checking
Colin Walters [Mon, 29 Jun 2015 15:09:00 +0000 (11:09 -0400)]
core: Fix inverted conditional in GPG checking

10 years agopull: Error if gpg=true and summary is 404, add more tests
Colin Walters [Sat, 27 Jun 2015 16:00:49 +0000 (12:00 -0400)]
pull: Error if gpg=true and summary is 404, add more tests

I did a quick audit pass through the pull code.  What I focused on the
most is the case where `gpg-verify-summary=true`, and in particular
where `gpg-verify=false` too.  This should be a valid and secure
configuration.

The primary change here is to error out very quickly if either
`summary` or `summary.sig` are 404.  Previously, we'd only error out
if we were processing deltas.

Expand the existing test case to cover this, plus invalid summary and
invalid sig.  (The test case was failing with current git master too).

10 years agoostree_repo_remote_fetch_summary: honor gpg-verify-summary
Giuseppe Scrivano [Wed, 24 Jun 2015 12:19:34 +0000 (14:19 +0200)]
ostree_repo_remote_fetch_summary: honor gpg-verify-summary

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agotests: add test for check for remote add --set=gpg-verify-summary=true
Giuseppe Scrivano [Wed, 3 Jun 2015 10:55:30 +0000 (12:55 +0200)]
tests: add test for check for remote add --set=gpg-verify-summary=true

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agopull: fail if GPG is enabled and the summary is not signed
Giuseppe Scrivano [Wed, 27 May 2015 08:35:09 +0000 (10:35 +0200)]
pull: fail if GPG is enabled and the summary is not signed

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agorepo: new function ostree_repo_remote_get_gpg_verify_summary
Giuseppe Scrivano [Wed, 3 Jun 2015 08:18:03 +0000 (10:18 +0200)]
repo: new function ostree_repo_remote_get_gpg_verify_summary

It allows to specify whether GPG verification for the summary file is
enabled for a specific repository.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agopull: verify summary signatures also when not mirroring
Giuseppe Scrivano [Wed, 27 May 2015 08:12:11 +0000 (10:12 +0200)]
pull: verify summary signatures also when not mirroring

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agoostree: Add a "remote refs" command
Matthew Barnes [Sun, 7 Jun 2015 19:20:14 +0000 (15:20 -0400)]
ostree: Add a "remote refs" command

Works like "ostree refs" but fetches refs from a remote repo.

This depends on the remote repo having a summary file, but any repo
being served over HTTP *ought* to have one.

10 years agorepo: Add ostree_repo_remote_fetch_summary()
Matthew Barnes [Sun, 7 Jun 2015 17:41:04 +0000 (13:41 -0400)]
repo: Add ostree_repo_remote_fetch_summary()

Reusable method for fetching a summary file and signatures.

10 years agometalink: Return requested file as a GBytes
Matthew Barnes [Wed, 10 Jun 2015 19:40:42 +0000 (15:40 -0400)]
metalink: Return requested file as a GBytes

This may not be the best idea for general usage, but the only use case
for metalinks currently is fetching a summary file and those are pretty
small.  Far more convenient to return the file content in a GBytes.

10 years agometalink: Allow NULL for "out" params in metalink requests
Matthew Barnes [Wed, 10 Jun 2015 18:37:42 +0000 (14:37 -0400)]
metalink: Allow NULL for "out" params in metalink requests

Caller may not be interested in all the outbound params, particularly
"fetching_sync_uri".

10 years agorepo: Redo ostree_repo_remote_get_url()
Matthew Barnes [Sat, 6 Jun 2015 20:47:15 +0000 (16:47 -0400)]
repo: Redo ostree_repo_remote_get_url()

Make it work like in ostree_repo_pull_with_options(), handling "file://"
remotes and inheriting the "url" option from parent repos if needed.

10 years agorepo: Handle "file" remotes in ostree_repo_remote_get_gpg_verify()
Matthew Barnes [Sat, 6 Jun 2015 20:32:45 +0000 (16:32 -0400)]
repo: Handle "file" remotes in ostree_repo_remote_get_gpg_verify()

10 years agorepo: Add _ostree_repo_get_remote_option_inherit()
Matthew Barnes [Sat, 6 Jun 2015 19:52:44 +0000 (15:52 -0400)]
repo: Add _ostree_repo_get_remote_option_inherit()

Split out from ostree-repo-pull.c.  Still private but more reusable now.

10 years agorepo: Add _ostree_repo_remote_new_fetcher()
Matthew Barnes [Fri, 5 Jun 2015 20:39:11 +0000 (16:39 -0400)]
repo: Add _ostree_repo_remote_new_fetcher()

Creates and configures an OstreeFetcher instance for a given remote.

Split out from ostree_repo_pull_with_options().

10 years agodiff: Fix adding CLI options twice
Matthew Barnes [Thu, 18 Jun 2015 21:58:13 +0000 (17:58 -0400)]
diff: Fix adding CLI options twice

10 years agotests/metalink: Add a case with nested unknown elements
Colin Walters [Tue, 16 Jun 2015 01:09:37 +0000 (21:09 -0400)]
tests/metalink: Add a case with nested unknown elements

10 years agometalink: Fix behavior when requested file is not found
Matthew Barnes [Sun, 14 Jun 2015 19:33:22 +0000 (15:33 -0400)]
metalink: Fix behavior when requested file is not found

The state machine's "passthrough_previous" field never got set, so the
machine gets put back into the wrong state after a passthrough phase.
Couple other minor issues around error handling.

10 years agopull-local: Support --depth option
Dan Nicholson [Mon, 8 Jun 2015 17:11:11 +0000 (10:11 -0700)]
pull-local: Support --depth option

Like pull, allow pull-local to mirror another another repository by
specifying how many parents to traverse.

https://bugzilla.gnome.org/show_bug.cgi?id=750581

10 years agotests/test-pull-mirror-summary.sh: remove empty newline
Giuseppe Scrivano [Fri, 12 Jun 2015 11:10:02 +0000 (13:10 +0200)]
tests/test-pull-mirror-summary.sh: remove empty newline

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agoautogen.sh: fix typo
Giuseppe Scrivano [Fri, 12 Jun 2015 07:43:34 +0000 (09:43 +0200)]
autogen.sh: fix typo

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agorepo: Change GPG verification policy
Matthew Barnes [Fri, 5 Jun 2015 16:45:41 +0000 (12:45 -0400)]
repo: Change GPG verification policy

The global keyring directory (trusted.gpg.d) is deprecated.  Only use it
when a specified remote does NOT have its own keyring, or when verifying
local repository objects.

Note, because mixing in the global keyring directory is now an explicit
choice, OstreeGpgVerifier no longer needs to implement GInitableIface.

10 years agoFix double free in ostree_repo_pull_with_options
John Hiesey [Wed, 6 May 2015 23:43:06 +0000 (16:43 -0700)]
Fix double free in ostree_repo_pull_with_options

Duplicate the commit checksum for expected_commit_sizes since it's also
used as a value in requested_refs_to_fetch.

https://bugzilla.gnome.org/show_bug.cgi?id=750366

10 years agoRevert "tests: skip test-commit-sign.sh when not root"
Dan Nicholson [Wed, 3 Jun 2015 20:02:41 +0000 (13:02 -0700)]
Revert "tests: skip test-commit-sign.sh when not root"

This reverts commit d3545b0661f3247cd8c106e64a71052ce9952243. Since the
test is now using the temporary copy of the gpg homedir, it is no longer
owned by root.

10 years agotests: Use temporary gpg homedir
Dan Nicholson [Wed, 3 Jun 2015 19:54:36 +0000 (12:54 -0700)]
tests: Use temporary gpg homedir

libtest always makes a copy of the gpghome directory to the test
directory, so there's no need to operate on the installed copy. This
allows test-remote-gpg-import to pass as an unprivileged user since it
otherwise couldn't create the temp files gpgme creates.

10 years agotests: Use readdir64 when _FILE_OFFSET_BITS set
Dan Nicholson [Wed, 3 Jun 2015 19:34:37 +0000 (12:34 -0700)]
tests: Use readdir64 when _FILE_OFFSET_BITS set

On 32 bit systems, _FILE_OFFSET_BITS will be set to 64 by
AC_SYS_LARGEFILE. This causes the glibc headers to use readdir64 rather
than readdir. Emulate that behavior in the preloader or the tests will
all fail with "No such file or directory".

10 years agotests: Link test-gpg-verify-result with gpgme
Dan Nicholson [Tue, 12 May 2015 22:48:22 +0000 (15:48 -0700)]
tests: Link test-gpg-verify-result with gpgme

This test uses gpgme directly to verify the signatures, so it needs to
find the gpgme headers and link with gpgme to ensure the linker can
resolve the symbols.

10 years agoFix tests on 32 bit systems
John Hiesey [Wed, 6 May 2015 23:41:55 +0000 (16:41 -0700)]
Fix tests on 32 bit systems

Use guint64 when the 't' format is used for GVariant

10 years agogpg: Gracefully handle no trusted.gpg.d directory
Matthew Barnes [Thu, 28 May 2015 20:25:51 +0000 (16:25 -0400)]
gpg: Gracefully handle no trusted.gpg.d directory

This is a deprecated fallback method anyway.  We prefer
remote-specific keyrings now.

https://bugzilla.gnome.org/750049

10 years agoRelease 2015.7
Colin Walters [Tue, 2 Jun 2015 16:59:48 +0000 (12:59 -0400)]
Release 2015.7

10 years agotests/remote-gpg-import: Only commit workdir
Colin Walters [Tue, 2 Jun 2015 16:38:26 +0000 (12:38 -0400)]
tests/remote-gpg-import: Only commit workdir

Just noticed this while debugging something else.  We don't want to
commit the whole test dir, just the workdir.

Trying to commit the repo itself is potentially subject to race
conditions at least.

10 years agotests: Run all tests through a randomized readdir()
Colin Walters [Tue, 2 Jun 2015 02:34:14 +0000 (22:34 -0400)]
tests: Run all tests through a randomized readdir()

Having undefined (but in practice rarely changing) ordering for
`readdir()` ended up screwing us over for bootloader config
generation; see https://bugzilla.redhat.com/show_bug.cgi?id=1226520

Let's make things significantly more likely to fail more quickly in
the future if similar bugs are introduced.  We accomplish this by
introducing a little `LD_PRELOAD` library that randomizes the results
of `readdir()`.

10 years agoRevert "tests: Run all tests through a randomized readdir()"
Colin Walters [Tue, 2 Jun 2015 16:02:24 +0000 (12:02 -0400)]
Revert "tests: Run all tests through a randomized readdir()"

Unintentionally pushed.

This reverts commit ce49264157f9005e664557613cbbf67f54174682.

10 years agotests: Add a test-pull-summary-sigs
Colin Walters [Mon, 1 Jun 2015 22:40:44 +0000 (18:40 -0400)]
tests: Add a test-pull-summary-sigs

This is intended to cover non-mirroring usage of GPG + summary +
deltas.

10 years agorepo: Don't crash when creating a summary if we have --empty deltas
Colin Walters [Mon, 1 Jun 2015 22:40:04 +0000 (18:40 -0400)]
repo: Don't crash when creating a summary if we have --empty deltas

10 years agotests: Add a commented out test for mirroring with deltas
Colin Walters [Mon, 1 Jun 2015 22:15:42 +0000 (18:15 -0400)]
tests: Add a commented out test for mirroring with deltas